'\" te
.\"  Copyright 1989 AT&T
.\" Copyright (c) 2006, Sun Microsystems, Inc.
.\"  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH BCANPUT 9F "Jan 16, 2006"
.SH NAME
bcanput \- test for flow control in specified priority band
.SH SYNOPSIS
.LP
.nf
#include <sys/stream.h>



\fBint\fR \fBbcanput\fR(\fBqueue_t *\fR\fIq\fR, \fBunsigned char\fR \fIpri\fR);
.fi

.SH INTERFACE LEVEL
.sp
.LP
Architecture independent level 1 (DDI/DKI).
.SH PARAMETERS
.sp
.ne 2
.na
\fB\fIq\fR\fR
.ad
.RS 7n
Pointer to the message queue.
.RE

.sp
.ne 2
.na
\fB\fIpri\fR\fR
.ad
.RS 7n
Message priority.
.RE

.SH DESCRIPTION
.sp
.LP
The \fBbcanput()\fR function searches through the stream (starting at \fIq\fR)
until it finds a queue containing a service routine where the message can be
enqueued, or until it reaches the end of the stream. If found, the queue
containing the service routine is tested to see if there is room for a message
of priority \fIpri\fR in the queue.
.sp
.LP
If \fIpri\fR is \fB0\fR, \fBbcanput()\fR is equivalent to a call with
\fBcanput\fR(9F).
.sp
.LP
\fBcanputnext(\fR\fIq\fR\fB)\fR and
\fBbcanputnext(\fR\fIq\fR\fB,\fR\fIpri\fR\fB)\fR should always be used in
preference to \fBcanput(\fR\fIq\fR\fB\(->q_next)\fR and
\fBbcanput(\fR\fIq\fR\fB\(->q_next,\fR\fIpri\fR\fB)\fR respectively.
.SH RETURN VALUES
.sp
.ne 2
.na
\fB\fB1\fR\fR
.ad
.RS 5n
If a message of priority \fIpri\fR can be placed on the queue.
.RE

.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.RS 5n
If the priority band is full.
.RE

.SH CONTEXT
.sp
.LP
The \fBbcanput()\fR function can be called from user, interrupt, or kernel
context.
.SH SEE ALSO
.sp
.LP
.BR bcanputnext (9F),
.BR canput (9F),
.BR canputnext (9F),
.BR putbq (9F),
.BR putnext (9F)
.sp
.LP
\fIWriting Device Drivers\fR
.sp
.LP
\fISTREAMS Programming Guide\fR
.SH WARNINGS
.sp
.LP
Drivers are responsible for both testing a queue with \fBbcanput()\fR and
refraining from placing a message on the queue if \fBbcanput()\fR fails.
